<?php

include "function_xml_atom.php";

function FlushNetDevToSys($query_string)
{
	$number = GetNumberOfNode($query_string);
	$results = GetAttribute($query_string);
	
	$command_string = "";
	$command_path = "/sbin/ifconfig ";
	for ($i = 0; $i < $number; $i ++)
	{
		$dev_name = "eth". $index;
		if ($i)
		{
			$dev_name = $dev_name. ":". ($i - 1);
			$command_string .= $command_path. $dev_name. " down &> /dev/null;";
		}
		else
		{
			$dev_name = $dev_name;
			$command_string .= $command_path. $dev_name. " 0 &> /dev/null;";
		}
	}
	shell_exec($command_string);

}

function FlushNetDevToSysByIndex($index)
{
	$query_string = "/MINI/NETWORK/INTERFACES/INTERFACE[".$index . "]/ADDRESSES/ADDRESS";
	FlushNetDevToSys($query_string);
}

function FlushNetDevToSysByName($name)
{
	$query_string = "/MINI/NETWORK/INTERFACES/INTERFACE[@Name=".$name . "]/ADDRESSES/ADDRESS";
	FlushNetDevToSys($query_string);
}



?>
